#!/usr/bin/env python3

import os

# Path to ffconf.h file
ffconf_path = 'G:\\Espressif\\frameworks\\esp-idf-v5.5.1\\components\\fatfs\\src\\ffconf.h'

def update_ffconf():
    print(f"Updating {ffconf_path}...")
    
    # Check if file exists
    if not os.path.exists(ffconf_path):
        print(f"File not found: {ffconf_path}")
        return False
    
    # Read file content
    with open(ffconf_path, 'r') as f:
        content = f.read()
    
    # Update FF_FS_CASESENSITIVE to 2
    updated_content = content.replace("#define FF_FS_CASESENSITIVE 1", "#define FF_FS_CASESENSITIVE 2")
    
    # Write updated content back to file
    with open(ffconf_path, 'w') as f:
        f.write(updated_content)
    
    print("Updated FF_FS_CASESENSITIVE to 2")
    return True

if __name__ == "__main__":
    update_ffconf()
